<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <title>程序猿的小本本 </title>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">


<meta name="description" content="光说有毛用|程序猿的小本本" />

<meta name="keywords" content="">


<meta property="og:title" content="程序猿的小本本 ">
<meta property="og:site_name" content="程序猿的小本本"/>
<meta property="og:url" content="http://replace-this-with-your-hugo-site.com/" />
<meta property="og:locale" content="en-us">


<meta property="og:type" content="website" />



<link href="http://replace-this-with-your-hugo-site.com/index.xml" rel="alternate" type="application/rss+xml" title="程序猿的小本本" />

<link rel="canonical" href="http://replace-this-with-your-hugo-site.com/" />

<link rel="apple-touch-icon-precomposed" sizes="144x144" href="http://replace-this-with-your-hugo-site.com/touch-icon-144-precomposed.png">
<link href="http://replace-this-with-your-hugo-site.com/favicon.png" rel="icon">
<meta name="theme-color" content="#2053AB">
<meta name="generator" content="Hugo 0.17-DEV" />

  <!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

<link href='https://fonts.googleapis.com/css?family=Merriweather:300%7CRaleway%7COpen+Sans' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://replace-this-with-your-hugo-site.com/css/font-awesome.min.css">
<link rel="stylesheet" href="http://replace-this-with-your-hugo-site.com/css/style.css">
<link rel="stylesheet" href="http://replace-this-with-your-hugo-site.com/css/highlight/default.css">

  
</head>
<body>
  <main id="main-wrapper" class="container main_wrapper has-sidebar">
    <header id="main-header" class="container main_header">
  <div class="container brand">
  <div class="container title h1-like">
  <a class="baselink" href="http://replace-this-with-your-hugo-site.com/">
  程序猿的小本本

</a>

</div>

  
<div class="container topline">
  
  光说有毛用


</div>


</div>

  <nav class="container nav primary no-print">
  

<a class="homelink" href="http://replace-this-with-your-hugo-site.com/">Home</a>


  
<a href="http://replace-this-with-your-hugo-site.com/about">About</a>

<a href="http://replace-this-with-your-hugo-site.com/post" title="Show list of posts">Posts</a>

<a href="http://replace-this-with-your-hugo-site.com/tags" title="Show list of tags">Tags</a>


</nav>

<div class="container nav secondary no-print">
  
<a id="contact-link-email" class="contact_link" href="mailto:chennqqi@qq.com">
  <span class="fa fa-envelope-square"></span><span>email</span></a>



<a id="contact-link-github" class="contact_link" href="https://github.com/chennqqi?tab=repositories">
  <span class="fa fa-github-square"></span><span>github</span></a>

















</div>


  

</header>


<section id="main-content" class="container main_content homepage">
  <header class="container header">
    <h1>程序猿的小本本
</h1>

    <span>last update: <time datetime="2016-01-11T14:48:49Z">11 January at 2:48pm</time>
</span>

  </header>
  
  
    <article class="container content summary">
  <div class="container hat">
  <h2><a href="http://replace-this-with-your-hugo-site.com/2015/09/08/programer_barbecue.html">论程序员如何转行烧烤行业
</a>
</h2>

  <time datetime="2015-09-08">8 Sep, 2015</time>

</div>

  <p class="container content">
  
  
    从oschina动弹上看到的,赶紧收藏下来，说不定哪天就用得着呢
  


</p>


  <div class="container readlink">
  <a href="http://replace-this-with-your-hugo-site.com/2015/09/08/programer_barbecue.html">Read more &rarr;</a>

</div>


</article>

  
    <article class="container content summary">
  <div class="container hat">
  <h2><a href="http://replace-this-with-your-hugo-site.com/2015/09/07/get_subset_order.html">集合算法题
</a>
</h2>

  <time datetime="2015-09-07">7 Sep, 2015</time>

</div>

  <p class="container content">
  
  
    有点意思的集合算法题；不是特别简单，也不是特别复杂，想做好还得好好想想。 已知现在有若干组集合,集合的元素由字符串构成 set1 = {"abc","bcd",...}; ... setn = {...} 1. 求所有集合的并集UnionSet 2. 将集合UnionSet中元素顺序进行编号，求出每个子集中元素的编号； 3. 选取Unionset中任意个元素，组成新的集合，求原有子集中哪些是新集合的子集(2015-09-08补充) 编程对于给定的集合以最小的时间代价完成1和2 我先说一下我的想法 我说一下我的想法； 用map来做并集是思路是可行的。但是用std::map效率不高，还有很大空间。 数据量稍微一大，std::map的插入会变慢；据说std::map是基于平衡树的，效率是O( log(N) ) 的，所以用hashmap的话效率会高于std::map，那么这里就要用一个效率比较高的 hashmap 。关于hash算法的探究也算是一个话题； 将std::string放入map之后效率也会降低，直接用char* 题目2中没有要求集合元素是有序的，而用std::map完成之后是有序的；这不是重点。 重点是集合中顺序，如果已经有序了，可以将每个子集里的元素指针做二分查找(如果用char*的话）算是比较快的一种方法；如果是无序的需要做循环遍历；这都不是很好的方法。 我能想到更好的方法是在题目1，插入数据时，将数据所在子集的指针作为最终并集中元素的一个成员变量（链表），这样最终产生并集后: idx = 0 for (element in unionset) { for (setPtr in element.setPtrsList) { setPtr.subsetPtr[setPtr.elementIdx].idx = idx } idx++ } setPtr.subsetPtr 子集指针； subsetPtr[element].idx 是题目要求的结果;是子集中元素在UnionSet中的索引顺序 setPtr.elementIdx 是元素在子集中的索引，可以保存在setPtrsList中 IndexOf(element) = setPtr. 就是利用数据元素下标来处理； &nbsp;
  


</p>


  <div class="container readlink">
  <a href="http://replace-this-with-your-hugo-site.com/2015/09/07/get_subset_order.html">Read more &rarr;</a>

</div>


</article>

  
    <article class="container content summary">
  <div class="container hat">
  <h2><a href="http://replace-this-with-your-hugo-site.com/2015/09/07/vs_error_include_cpp.html">Visualstudio C语言包含C&#43;&#43;头文件编译不通过
</a>
</h2>

  <time datetime="2015-09-07">7 Sep, 2015</time>

</div>

  <p class="container content">
  
  
    error C2054: expected '(' to follow 'using' error C2061: syntax error : identifier 'using' c:\program files\microsoft visual studio 10.0\vc\include\cstdio(38): error C2054: expected '(' to follow 'using' c:\program files\microsoft visual studio 10.0\vc\include\cstdio(40): error C2061: syntax error : identifier 'using' c:\program files\microsoft visual studio 10.0\vc\include\cstdio(40): error C2054: expected '(' to follow 'using' c:\program files\microsoft visual studio 10.0\vc\include\cstdio(40): error C2061: syntax error : identifier 'using' c:\program files\microsoft visual studio 10.0\vc\include\cstdio(41): error C2061: syntax
  


</p>


  <div class="container readlink">
  <a href="http://replace-this-with-your-hugo-site.com/2015/09/07/vs_error_include_cpp.html">Read more &rarr;</a>

</div>


</article>

  
    <article class="container content summary">
  <div class="container hat">
  <h2><a href="http://replace-this-with-your-hugo-site.com/2015/09/04/scrapycmdline.html">scrapycmdline
</a>
</h2>

  <time datetime="2015-09-04">4 Sep, 2015</time>

</div>

  <p class="container content">
  
  
    scrapy没有找到包 Traceback (most recent call last): File "/usr/local/bin/scrapy", line 7, in &lt;module&gt; from scrapy.cmdline import execute ImportError: No module named scrapy.cmdline 如果没有正确安装scrapy，请重新安装scrapy 如果正确安装了scrapy,那么就可能是你系统上有多个python 如果是windows，使用正确的环境变量 如果是linux，多半是因为有多个python导致的。 修改yum里的python
  


</p>


  <div class="container readlink">
  <a href="http://replace-this-with-your-hugo-site.com/2015/09/04/scrapycmdline.html">Read more &rarr;</a>

</div>


</article>

  
  
<div class="container pagination">
  


<a aria-label="First" href="http://replace-this-with-your-hugo-site.com//">
  <span aria-hidden="true">««</span>
</a>

<a aria-label="Previous" href="http://replace-this-with-your-hugo-site.com//page/7/">
  <span aria-hidden="true">«</span>
</a>


<a href="http://replace-this-with-your-hugo-site.com//">
  1
</a>

<a href="http://replace-this-with-your-hugo-site.com//page/2/">
  2
</a>

<a href="http://replace-this-with-your-hugo-site.com//page/3/">
  3
</a>

<a href="http://replace-this-with-your-hugo-site.com//page/4/">
  4
</a>

<a href="http://replace-this-with-your-hugo-site.com//page/5/">
  5
</a>

<a href="http://replace-this-with-your-hugo-site.com//page/6/">
  6
</a>

<a href="http://replace-this-with-your-hugo-site.com//page/7/">
  7
</a>

<a class="active" href="http://replace-this-with-your-hugo-site.com//page/8/">
  8
</a>

<a href="http://replace-this-with-your-hugo-site.com//page/9/">
  9
</a>

<a href="http://replace-this-with-your-hugo-site.com//page/10/">
  10
</a>

<a href="http://replace-this-with-your-hugo-site.com//page/11/">
  11
</a>

<a href="http://replace-this-with-your-hugo-site.com//page/12/">
  12
</a>

<a href="http://replace-this-with-your-hugo-site.com//page/13/">
  13
</a>

<a href="http://replace-this-with-your-hugo-site.com//page/14/">
  14
</a>

<a href="http://replace-this-with-your-hugo-site.com//page/15/">
  15
</a>


<a aria-label="Next" href="http://replace-this-with-your-hugo-site.com//page/9/">
  <span aria-hidden="true">»</span>
</a>

<a aria-label="Last" href="http://replace-this-with-your-hugo-site.com//page/15/">
  <span aria-hidden="true">»»</span>
</a>


</div>


</section>

      <footer id="main-footer" class="container main_footer">
  

  <div class="container nav foot no-print">
  

  <a class="toplink" href="#">back to top</a>

</div>

  <div class="container credits">
  
<div class="container footline">
  
  code with <i class='fa fa-heart'></i>


</div>


  
<div class="container copyright">
  
  &copy; 2016 gsymy.com.


</div>


</div>

</footer>

    </main>
    
<script type="text/javascript">
  (function() {
    
    
    if (window.location.hostname == "localhost")
      return;

    var dsq = document.createElement('script'); dsq.async = true; dsq.type = 'text/javascript';
    dsq.src = '//your_disqus_shortname.disqus.com/count.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  })();
</script>



<script src="http://replace-this-with-your-hugo-site.com/js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>



<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'Your Google Analytics tracking code', 'auto');
  ga('send', 'pageview');

</script>


    
  </body>
</html>

